Skip to content

Properly cleanup when the Widget is initialized by an implicit as_widget() #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 21, 2025

Conversation

cpsievert
Copy link
Collaborator

@cpsievert cpsievert commented May 21, 2025

#191 introduced a problem where, if the widget that is initialized by an internal as_widget() call, then it doesn't get cleaned up.

For a minimal reprex of the issue, notice how clicking the button will keep inserting new plots

import plotly.express as px
from shiny.express import input, ui

from shinywidgets import render_plotly

ui.input_action_button("redraw", "Redraw")

@render_plotly
def plot():
    input.redraw()
    return px.histogram(
        px.data.tips(),
        x="total_bill",
    )

@cpsievert cpsievert merged commit 212acf8 into main May 21, 2025
5 checks passed
@cpsievert cpsievert deleted the fix/as-widget-cleanup branch May 21, 2025 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant